package com.wangshouyu.mp.pay.v3.transactions;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 基础下单请求
 * @date 2020/8/14 9:21
 */
public abstract class BaseTransactionsRequest implements Serializable {

    /**
     * 公众账号ID
     * 微信支付分配的公众账号ID（企业号corpid即为此appId）
     */
    @SerializedName(value = "appid")
    @JsonProperty(value = "appid")
    @JSONField(name = "appid")
    private String appId;

    /**
     * 商户号
     * 微信支付分配的商户号
     */
    @SerializedName(value = "mchid")
    @JsonProperty(value = "mchid")
    @JSONField(name = "mchid")
    private String mchId;

    /**
     * 商品描述
     */
    @SerializedName(value = "description")
    @JsonProperty(value = "description")
    @JSONField(name = "description")
    private String description;

    /**
     * 商户订单号
     */
    @SerializedName(value = "out_trade_no")
    @JsonProperty(value = "out_trade_no")
    @JSONField(name = "out_trade_no")
    private String outTradeNo;

    /**
     * 交易结束时间
     */
    @SerializedName(value = "time_expire")
    @JsonProperty(value = "time_expire")
    @JSONField(name = "time_expire")
    private String timeExpire;

    /**
     * 附加数据
     */
    @SerializedName(value = "attach")
    @JsonProperty(value = "attach")
    @JSONField(name = "attach")
    private String attach;

    /**
     * 通知地址
     */
    @SerializedName(value = "notify_url")
    @JsonProperty(value = "notify_url")
    @JSONField(name = "notify_url")
    private String notifyUrl;

    /**
     * 订单优惠标记
     */
    @SerializedName(value = "goods_tag")
    @JsonProperty(value = "goods_tag")
    @JSONField(name = "goods_tag")
    private String goodsTag;

    /**
     * 订单金额信息
     */
    @SerializedName(value = "amount")
    @JsonProperty(value = "amount")
    @JSONField(name = "amount")
    private TransactionsAmount amount;

    /**
     * 优惠功能
     */
    @SerializedName(value = "detail")
    @JsonProperty(value = "detail")
    @JSONField(name = "detail")
    private TransactionsDetail detail;

    /**
     * 场景信息
     */
    @SerializedName(value = "scene_info")
    @JsonProperty(value = "scene_info")
    @JSONField(name = "scene_info")
    private TransactionsSceneInfo sceneInfo;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getTimeExpire() {
        return timeExpire;
    }

    public void setTimeExpire(String timeExpire) {
        this.timeExpire = timeExpire;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public String getGoodsTag() {
        return goodsTag;
    }

    public void setGoodsTag(String goodsTag) {
        this.goodsTag = goodsTag;
    }

    public TransactionsAmount getAmount() {
        return amount;
    }

    public void setAmount(TransactionsAmount amount) {
        this.amount = amount;
    }

    public TransactionsDetail getDetail() {
        return detail;
    }

    public void setDetail(TransactionsDetail detail) {
        this.detail = detail;
    }

    public TransactionsSceneInfo getSceneInfo() {
        return sceneInfo;
    }

    public void setSceneInfo(TransactionsSceneInfo sceneInfo) {
        this.sceneInfo = sceneInfo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        BaseTransactionsRequest that = (BaseTransactionsRequest) o;
        return Objects.equals(appId, that.appId) &&
                Objects.equals(mchId, that.mchId) &&
                Objects.equals(description, that.description) &&
                Objects.equals(outTradeNo, that.outTradeNo) &&
                Objects.equals(timeExpire, that.timeExpire) &&
                Objects.equals(attach, that.attach) &&
                Objects.equals(notifyUrl, that.notifyUrl) &&
                Objects.equals(goodsTag, that.goodsTag) &&
                Objects.equals(amount, that.amount) &&
                Objects.equals(detail, that.detail) &&
                Objects.equals(sceneInfo, that.sceneInfo);
    }

    @Override
    public int hashCode() {
        return Objects.hash(appId, mchId, description, outTradeNo, timeExpire, attach, notifyUrl, goodsTag, amount, detail, sceneInfo);
    }

    @Override
    public String toString() {
        return "BaseTransactionsRequest{" +
                "appId='" + appId + '\'' +
                ", mchId='" + mchId + '\'' +
                ", description='" + description + '\'' +
                ", outTradeNo='" + outTradeNo + '\'' +
                ", timeExpire='" + timeExpire + '\'' +
                ", attach='" + attach + '\'' +
                ", notifyUrl='" + notifyUrl + '\'' +
                ", goodsTag='" + goodsTag + '\'' +
                ", amount=" + amount +
                ", detail=" + detail +
                ", sceneInfo=" + sceneInfo +
                '}';
    }
}
